
/**
 * 下载文件
 * @param projectName 项目名
 * @param version  版本
 * @param credentialsId 凭证
 * @param url  下载链接
 * @return
 */

def call( String projectName,String version , String credentialsId, String url ,String fileType  ) {
    String filePath="/var/jenkins_home/down/'${projectName}'/"
    mkdir(filePath)
    withCredentials([usernamePassword(
            credentialsId: credentialsId,
            usernameVariable: 'NX_USER',
            passwordVariable: 'NX_PWD')]) {
        sh(script: """
            curl --progress-bar  --connect-timeout 10  --max-time 300    --retry 3 --retry-delay 5  -u "\$NX_USER:\$NX_PWD" '${url}'  -o '${filePath}''${projectName}''${fileType}'
        """)

    }
    return 'ok'
}
@NonCPS
mkdir( String filePath  ) {
     sh(script: "mkdir -p  '${filePath}'")
 }